{{ $site := site }}
{{ $treeCategory := treeCategory "* from category WHERE status in (1,2) order by status desc,sortNo desc" }}
{{ $content := selectList "content" "" 1 1000 "id,categoryID,title FROM content WHERE status in (1,2) order by status  desc, sortNo asc" }}

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#FFFFFF">
<meta name="color-scheme" content="light dark">
<script>
  var basePath="{{basePath}}";
</script>
<link rel="icon" type="image/x-icon" href="{{basePath}}{{$site.Favicon}}" />
<link rel="stylesheet" href="{{basePath}}css/book.min.c58292d36b18b675680ab9baea2029204537b839ea72f258746ec0f32ce8d6c8.css">
</head>

<body>
  <input type="checkbox" class="hidden toggle" id="menu-control" />
  <input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex">
  <aside class="book-menu">
    <div class="book-menu-content">
      <nav>
        <h2 class="book-brand">
          <a class="flex align-center" href="{{basePath}}">
              <span>{{ $site.Title }}</span>
          </a>
        </h2>
        <div class="book-search">
          <input type="text" id="book-search-input" placeholder="Search" aria-label="Search" maxlength="64" data-hotkeys="s/" />
          <div class="book-search-spinner hidden"></div>
          <ul id="book-search-results"></ul>
        </div>
        <ul>
        {{ range $k,$v := $treeCategory }}
          {{$navCheck:=""}}
          {{if eq $k 0}}
            {{$navCheck = "checked" }}
          {{end}}

          {{$hrefURL:="###"}}
          {{if $v.HrefURL}}
          {{$hrefURL = $v.HrefURL}}
          {{end}}
       
         <li class="book-section-flat"><a href="{{$hrefURL}}" class="">{{$v.Name}}</a>
            <ul>
              {{if gt (len $v.Leaf) 0 }}
                {{ range $leafk,$leafv := $v.Leaf }}
                  {{if hasPrefix $.Id $leafv.Id}}
                     {{$navCheck = "checked" }}
                  {{end}}

                <li>
                  <input type="checkbox" id="section-{{$leafv.Id}}" class="toggle" {{$navCheck}}  />
                  <label for="section-{{$leafv.Id}}" class="flex justify-between"><a role="button" class="">{{$leafv.Name}}</a></label>
                
                  <ul>
                    {{ range $ck,$cv := $content.Data }}
                    {{if eq $leafv.Id $cv.CategoryID }}
                      {{if eq $cv.Id $.Id}}
                      <li><a href="{{basePath}}{{ trimPrefixSlash $cv.Id}}" class="active">{{ $cv.Title }}</a></li>
                      {{else}}
                      <li><a href="{{basePath}}{{ trimPrefixSlash $cv.Id}}">{{ $cv.Title }}</a></li>
                      {{end}}
                    {{end}}
                  {{end}}
                  </ul>

                </li>
                {{end}}
              {{end}}


             
              {{ range $ck,$cv := $content.Data }}
                {{if eq $v.Id $cv.CategoryID }}
                  {{if eq $cv.Id $.Id}}
                  <li><a href="{{basePath}}{{ trimPrefixSlash $cv.Id }}" class="active">{{ $cv.Title }}</a></li>
                  {{else}}
                  <li><a href="{{basePath}}{{ trimPrefixSlash $cv.Id }}">{{ $cv.Title }}</a></li>
                  {{end}}
                {{end}}
              {{end}}

            </ul>
          </li>
       
       {{end}}
      </ul>
      
      </nav>
      <script>
        (function(){var a=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(b){localStorage.setItem("menu.scrollTop",a.scrollTop)}),a.scrollTop=localStorage.getItem("menu.scrollTop")})()
      </script>
      <script type="text/javascript" src="{{basePath}}js/search.min.js"></script>
      <script type="text/javascript" src="{{basePath}}js/sw.js"></script>
      <script src="{{basePath}}js/flexsearch.min.js"></script>

    </div>
  </aside>
  <div class="book-page">